/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2010
 */

package com.sisterandbrother.model;

import java.util.Date;

import javacommon.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */

@Entity
@Table(name = "CHAT_MSG")
public class ChatMsg extends BaseEntity implements java.io.Serializable {
	private static final long serialVersionUID = 5454155825314635342L;

	// alias
	public static final String TABLE_ALIAS = "chat_msg";
	public static final String ALIAS_ID = "id";

	private Long id;

	private String senderName;
	private String receiverName;
	private String fontColor;
	private String content;
	private String senderIp;
	private Date sendTime;

	public ChatMsg() {

	}

	public ChatMsg(Long id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "native")
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getId() {
		return this.id;
	}

	public void setId(Long value) {
		this.id = value;
	}

	@Column(name = "FONTCOLOR", unique = false, insertable = true, updatable = true, length = 20)
	public String getFontColor() {
		return fontColor;
	}

	public void setFontColor(String fontColor) {
		this.fontColor = fontColor;
	}

	@Column(name = "SENDERNAME", unique = false, insertable = true, updatable = true, length = 20)
	public String getSenderName() {
		return senderName;
	}

	public void setSenderName(String senderName) {
		this.senderName = senderName;
	}

	@Column(name = "RECEIVERNAME", unique = false, insertable = true, updatable = true, length = 20)
	public String getReceiverName() {
		return receiverName;
	}

	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}

	@Column(name = "CONTENT", unique = false, insertable = true, updatable = true, length = 400)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "SENDERIP", unique = false, insertable = true, updatable = true, length = 20)
	public String getSenderIp() {
		return senderIp;
	}

	public void setSenderIp(String senderIp) {
		this.senderIp = senderIp;
	}

	@Column(name = "SENDTIME", unique = false, insertable = true, updatable = true)
	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("Id", getId()).toString();
	}

	public int hashCode() {
		return new HashCodeBuilder().append(getId()).toHashCode();
	}

	public boolean equals(Object obj) {
		if (obj instanceof ChatMsg == false)
			return false;
		if (this == obj)
			return true;
		ChatMsg other = (ChatMsg) obj;
		return new EqualsBuilder().append(getId(), other.getId()).isEquals();
	}

}
